package com.bingquan.company.mapstruct;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;

public class HttpRequestTool {
    public static void main(String[] args) {

        String url = "https://deliver.digitalgd.com.cn/traffic/gateway/common/api";
        String type = "application/json";
        String content = "content";
        // String noce_value = UUID.randomUUID().toString().replaceAll("-", "");
        // String timestamp_value = Long.toString(System.currentTimeMillis() / 1000L);
        // // String signature_value =

        // HttpResponse response = HttpRequest.post(url).contentType(type).body(JSONObject.toJSONString(content))
        // .header("x-tsp-paasid", "jtystjsgy")
        // .header("x-tsp-signature", "EBF99B0D521391E1016A5DC15985446DA96952F7EO04F18FOC66A837DC126E56")
        // .header("x-tsp-timestamp", "1645003340").header("x-tsp-nonce", "ec7909a845d346f9aeac81f272e60a9d")
        // .header("x-tsp-serviceid", "GDEM_14837095292036546571").execute();

        Map<String, String> map = new HashMap<>();
        map.put("content", "测试】尊敬的您好,本次您的验证码是");

        // String body = "{\"content\":\"【测试】尊敬的您好,本次您的验证码是\"}";

        HttpResponse response = HttpRequest.post(url).contentType(type).body(JSONObject.toJSONString(map))
            .header("x-tsp-paasid", "jtystjsgy")
            .header("x-tsp-signature", "EBF99B0D521391E1016A5DC15985446DA96952F7EO04F18FOC66A837DC126E56")
            .header("x-tsp-timestamp", "1645003340").header("x-tsp-nonce", "ec7909a845d346f9aeac81f272e60a9d")
            .header("x-tsp-serviceid", "GDEM_14837095292036546571").execute();
        System.out.println(response.body());

    }
}
